﻿using System.Security.Principal;

namespace OA.Controllers
{
    public class CurrentUserCookie : IPrincipal
	{
        /// <summary>
        ///  当前用户
        /// </summary>
		public UserInfo CurrentUser { get; set; }

        #region IPincipal 成员

        /// <summary>
        ///  身份
        /// </summary>
        [Newtonsoft.Json.JsonIgnore]
		public IIdentity Identity { get; private set; }

        /// <summary>
        ///  该用户是否是该对象
        /// </summary>
        /// <param name="role"></param>
        /// <returns></returns>
		bool IPrincipal.IsInRole(string role) => true;

		public void GenericIdentity(string username) => Identity = new GenericIdentity(username);

        #endregion
    }
}